
<div class="main mt10" >
    <!-- Star of area2s -->
    <div class="area2s">
    	<!-- Star of Col1 -->
    	<div class="col1">
			<div class="breadCrumb">
				<div class="fl"><span class="cRed fb">当前位置：</span>&nbsp;<?php echo CHtml::link('首页', array('/')); ?>&nbsp;›&nbsp;<a href="<?php echo CHtml::normalizeUrl(array('/qas')); ?>">在线问吧</a>&nbsp;›&nbsp;<strong>查看咨询提问</strong></div>
			</div> 
            <!--star of qasContent-->
			<div class="qasContent mt10">
				<div class="askQas">
                	<div class="title">
					<table cellpadding="0" cellspacing="0" border="0" width="100%">
						<tr>
							<td><h3><?php echo htmlspecialchars($qa->qaTitle); ?> <span class="<?php if($qa->qaStatus == QAs::STATUS_UNSOLVED) : ?>cOrg<?php elseif($qa->qaStatus == QAs::STATUS_SOLVED) : ?>cGre<?php endif; ?> fn">[<?php echo $qa->getStatusText(); ?>]</span></span></h3></td>
							<td class="tr"><span class="fn cHui1">发表时间：<?php echo fromNow($qa->qaDate); ?>&nbsp;&nbsp;&nbsp;&nbsp;作者：<?php echo $qa->author->userName(); ?></span></td>
						</tr>
					</table>
					
					<!--<span><?php echo htmlspecialchars($qa->qaTitle); ?> </span><span class="<?php if($qa->qaStatus == QAs::STATUS_UNSOLVED) : ?>cOrg<?php elseif($qa->qaStatus == QAs::STATUS_SOLVED) : ?>cGre<?php endif; ?> fn">[<?php echo $qa->getStatusText(); ?>]</span></span><span class="fn cHui1" style="display:inline !important; background:red;">发表时间：<?php echo fromNow($qa->qaDate); ?>&nbsp;&nbsp;&nbsp;&nbsp;作者：<?php echo $qa->author->userName(); ?></span>--></div>
                    <div class="content">
                    	<p><?php echo nl2br(htmlspecialchars($qa->qaContent)); ?></p>
                    </div>
                </div>
                <?php if(sizeof($replies)) : ?>
                <div class="answersQas mt10">
                	<div class="title"><span class="fl">回复内容</span><span class="fr fn cHui1" style="display:inline;">最后回复：<?php echo $replies[count($replies)-1]->author->userName(); ?></span></div>
                    <div class="content">
					<ul class="commentList mt10" id="commentList">
					<?php if($replies !== null) : ?>
					<?php foreach($replies as $reply) : ?>
                       <li>
							<div class="comment">
							<div class="fright tr author_1" style="color: #AAAAAA"><?php if($reply->author->getIsAdmin()) :  ?>咨询师<?php endif ?>&thinsp;<a href="<?php echo $reply->author->getIsAdmin() && $reply->author->psychologist !== null ? CHtml::normalizeUrl(array('/psychologist/view', 'id' => $reply->author->psychologist->psychologistId)) : CHtml::normalizeUrl(array('/users/viewprofile', 'id' => $reply->author->uid)); ?>" class="<?php if($reply->author->getIsAdmin() && $reply->author->psychologist !== null) : ?>psychologistLink<?php endif ?>"><?php echo $reply->author->userName(); ?></a>&thinsp;于<?php echo fromNow($reply->qaDate); ?>发表</div>
								<div class="hPor"><img src="<?php echo $reply->author->getAvatarUrl('small') ?>" /><a class="cGre<?php if($reply->author->getIsAdmin() && $reply->author->psychologist !== null) : ?> psychologistLink<?php endif ?>" href="<?php echo $reply->author->getIsAdmin() && $reply->author->psychologist !== null ? CHtml::normalizeUrl(array('/psychologist/view', 'id' => $reply->author->psychologist->psychologistId)) : CHtml::normalizeUrl(array('/users/viewprofile', 'id' => $reply->author->uid)); ?>"><?php echo $reply->author->userName(); ?></a></div>
                            	<p style="width:609px;"><?php echo nl2br(htmlspecialchars($reply->qaContent)); ?></p>
								<div class="cb"></div>
							</div>
                        </li>
                    <?php endforeach; ?>
                    <?php endif; ?>
                    </ul>
                    </div>
                </div>
                <?php endif; ?>
                <?php if($qa->canReply()) : ?>
                <?php echo CHtml::form(); ?>
                <div class="post mt10" id="reply_box">
                    <div class="postInner">
                    <?php if(ForumMembers::isAdmin()): ?>
                    <h3>对咨询者进行回复</h3>
                    <?php else :?>
                    <h3>这是您发起的咨询提问</h3>
                    <?php endif ?>
					<?php if( ! $_reply->isNewRecord) : ?><div class="notice_oktext" style="margin-top:10px;">您的回复发表成功。</div><?php endif; ?>
					<div class="mt10"></div>
                        <div class="postBody mt10">
                        	<?php if($qa->isResolved()) : ?>
                            <table border="0" cellpadding="0" cellspacing="0">
                                <tbody>
                                    <tr>
                                        <td class="tr" colspan="2"><div class="notice_oktext">提问已经成功解决，谢谢您对我们工作的支持。</div></td>
                                    </tr>
                                </tbody>
                            </table>
                        	<?php else : ?>
                            <table border="0" cellpadding="0" cellspacing="0">
                                <tbody>
                                    <tr>
                                        <td class="tr" valign="top">提问状态：</td>
                                        <td><input type="button" value="设置为已解决" onclick="window.location='<?php echo CHtml::normalizeUrl(array('/qas/changestatus', 'id' => $qa->qaId)) ?>';return false;" /> 如果您认为您已得到满意的答复，请肯定一下我们的工作，把提问状态设置为已解决。</td>
                                    </tr>
                                    <tr>
                                        <td>&nbsp;</td>
                                        <td>或者您认为还需要对提问进行补充，以及对咨询师进行回复：</td>
                                    </tr>	
                                    <tr>
                                        <td class="tr" valign="top">回复内容：</td>
                                        <td><textarea id="<?php echo CHtml::activeId($_reply, 'qaContent') ?>" name="<?php echo CHtml::activeName($_reply, 'qaContent') ?>" style="width:400px; height:90px;" class="ipt3"></textarea></td>
                                    </tr>
                                    <!--<tr>
                                        <td class="tr" valign="top">咨询状态：</td>
                                        <td></td>
                                    </tr>
                                    --><?php if($_reply->hasErrors()) : ?>
                                    <tr>
                                    	<td>&nbsp;</td>
                                    	<td>
										<?php $errors = $_reply->errors; if(isset($errors['qaTitle']) || isset($errors['qaContent'])) : ?>
                        				<div class="notice_error"><?php echo isset($errors['qaTitle'][0]) ? $errors['qaTitle'][0] : $errors['qaContent'][0]; ?></div>
                    					<?php endif; ?>
                    					</td>
                                    </tr>
                                    <?php endif; ?>
                                    <tr>
                                        <td>&nbsp;</td>
                                        <td><?php echo CHtml::submitButton('提交回复', array('class' => 'btn1'))?></td>
                                    </tr>								
                                </tbody>
                            </table>
                            <?php endif ?>
                        </div>
                    </div>    
				</div>
				<?php echo CHtml::endform(); ?>
				<?php elseif($qa->isResolved()) : ?>
                <div class="post mt10">
                    <div class="postInner">
                        <div class="notice_oktext">该提问已经成功解决。</div>
                    </div>    
				</div>
				<?php else: ?>
                <div class="post mt10">
                    <div class="postInner">
                        <div class="state mt10"><?php if(Users::isLogin()) : ?>您好，<?php echo Yii::app()->user->name; ?><?php else : ?>您好，您尚未<?php echo CHtml::link('登录', array('users/signin', 'rf' => urlencode(Yii::app()->request->pathInfo))); ?><?php endif; ?>，只有咨询者和咨询师才能发表回复。</div>
                    </div>    
				</div>
				<?php endif; ?>
            </div>
            <!--End of qasContent-->
        </div>
        <!-- End of Col1 -->
        <!-- Star of Col2 -->
        <div class="col2">
        	<?php echo CHtml::form(array('/qas/search'), 'get', array('id' => 'qas_search_form')); ?>
	        <div class="search">	
				<h3 class="cRed"><span class="icon"></span>问吧搜索</h3>
	            <p><input name="key" type="text" size="15" class="sIpt"/><br />
				<input type="submit" class="sBtn mt10" value="搜索" />
	            </p>
	        </div>
        	<?php echo CHtml::endForm(); ?>
			<?php $this->widget('QAsHistory') ?>
        	<?php $this->widget('RandomPsy'); ?>
        </div>
        <!-- End of Col2 -->
    </div><!-- End of area3s -->
</div>
<?php if(isPost()) : ?>
<script type="text/javascript">
window.location.hash = 'reply_box';
</script>
<?php endif ?>
